package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "sales_", schema = "boot", catalog = "")
public class Sales {//销售主表
    private int salesId;//销售id
    private String salesName;//销售主题
    private String salesMan;//执行人
    private Date salesDate;//预计签单日期
    private String salesPossibility;//可能性
    private BigDecimal salesMoney;//预期金额
    private String salesType;//产品类型
    private String salesSource;//来源
    private String salseLog;//跟踪日志
    private String salesNeed;//客户需求
    private String salesContact;//客户联系人
    private Date salesUpdatetime;//更新日期
    private Kehu kehu;//客户id
    private Stage stage;//阶段id
    private Status status;//状态id
    private int salesSc;//删除状态
    private List<Salesdetails> salesdetails;

    @Id
    @Column(name = "sales_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getSalesId() {
        return salesId;
    }

    public void setSalesId(int salesId) {
        this.salesId = salesId;
    }

    @Basic
    @Column(name = "sales_name", nullable = true, length = 200)
    public String getSalesName() {
        return salesName;
    }

    public void setSalesName(String salesName) {
        this.salesName = salesName;
    }

    @Basic
    @Column(name = "sales_man", nullable = true, length = 200)
    public String getSalesMan() {
        return salesMan;
    }

    public void setSalesMan(String salesMan) {
        this.salesMan = salesMan;
    }

    @Basic
    @Column(name = "sales_date", nullable = true)
    public Date getSalesDate() {
        return salesDate;
    }

    public void setSalesDate(Date salesDate) {
        this.salesDate = salesDate;
    }

    @Basic
    @Column(name = "sales_possibility", nullable = true, length = 200)
    public String getSalesPossibility() {
        return salesPossibility;
    }

    public void setSalesPossibility(String salesPossibility) {
        this.salesPossibility = salesPossibility;
    }

    @Basic
    @Column(name = "sales_money", nullable = true, precision = 2)
    public BigDecimal getSalesMoney() {
        return salesMoney;
    }

    public void setSalesMoney(BigDecimal salesMoney) {
        this.salesMoney = salesMoney;
    }

    @Basic
    @Column(name = "sales_type", nullable = true, length = 200)
    public String getSalesType() {
        return salesType;
    }

    public void setSalesType(String salesType) {
        this.salesType = salesType;
    }

    @Basic
    @Column(name = "sales_source", nullable = true, length = 200)
    public String getSalesSource() {
        return salesSource;
    }

    public void setSalesSource(String salesSource) {
        this.salesSource = salesSource;
    }

    @Basic
    @Column(name = "salse_log", nullable = true, length = 2000)
    public String getSalseLog() {
        return salseLog;
    }

    public void setSalseLog(String salseLog) {
        this.salseLog = salseLog;
    }

    @Basic
    @Column(name = "sales_need", nullable = true, length = 200)
    public String getSalesNeed() {
        return salesNeed;
    }

    public void setSalesNeed(String salesNeed) {
        this.salesNeed = salesNeed;
    }

    @Basic
    @Column(name = "sales_contact", nullable = true, length = 200)
    public String getSalesContact() {
        return salesContact;
    }

    public void setSalesContact(String salesContact) {
        this.salesContact = salesContact;
    }

    @Basic
    @Column(name = "sales_updatetime", nullable = true)
    public Date getSalesUpdatetime() {
        return salesUpdatetime;
    }

    public void setSalesUpdatetime(Date salesUpdatetime) {
        this.salesUpdatetime = salesUpdatetime;
    }

    @ManyToOne
    @JoinColumn(name = "k_id", referencedColumnName = "k_id")
    public Kehu getKehu() {
        return kehu;
    }

    public void setKehu(Kehu kehu) {
        this.kehu = kehu;
    }

    @ManyToOne
    @JoinColumn(name = "stage_id", referencedColumnName = "stage_id")
    public Stage getStage() {
        return stage;
    }

    public void setStage(Stage stage) {
        this.stage = stage;
    }

    @ManyToOne
    @JoinColumn(name = "status_id", referencedColumnName = "status_id")
    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    @Basic
    @Column(name = "sales_sc", nullable = true)
    public int getSalesSc() {
        return salesSc;
    }

    public void setSalesSc(int salesSc) {
        this.salesSc = salesSc;
    }

    @OneToMany(mappedBy ="sales",cascade=CascadeType.REMOVE)
    public List<Salesdetails> getSalesdetails() {
        return salesdetails;
    }

    public void setSalesdetails(List<Salesdetails> salesdetails) {
        this.salesdetails = salesdetails;
    }

    @Override
    public String toString() {
        return "Sales{" +
                "salesId=" + salesId +
                ", salesName='" + salesName + '\'' +
                ", salesMan='" + salesMan + '\'' +
                ", salesDate=" + salesDate +
                ", salesPossibility='" + salesPossibility + '\'' +
                ", salesMoney=" + salesMoney +
                ", salesType='" + salesType + '\'' +
                ", salesSource='" + salesSource + '\'' +
                ", salseLog='" + salseLog + '\'' +
                ", salesNeed='" + salesNeed + '\'' +
                ", salesContact='" + salesContact + '\'' +
                ", salesUpdatetime=" + salesUpdatetime +
                ", kehu=" + kehu +
                ", stage=" + stage +
                ", status=" + status +
                ", salesSc=" + salesSc +
                ", salesdetails=" + salesdetails +
                '}';
    }
}
